<script>
    $(function($) {
        $('body').layout('collapse', 'west');
        $('#resetDatabaseDiv').hide();
        $('#resetDatabaseBtn').click(function() {
            $.messager.confirm('Confirm', 'Are you sure you want to reset the DataBase?', function(r) {
                if (r) {
                    $.messager.confirm('Confirm', 'All your data will be replaced and there is no Rollback', function(r) {
                        if (r) {
                            resetDatabase();
                        }
                    })

                }
            });
        });
    });

    function resetDatabase() {
        $('div#divLoader').window('open');
        $('#resetDatabaseDiv').slideUp();
        $.ajax({
            type: "GET",
            url: '<?php echo $this->Html->url(array('controller' => 'CoreInstallation', 'action' => 'resetDatabaseAndFiles')); ?>',
            success: function(data) {
                $('#resetDatabaseDiv').html('<pre>' + data + '</pre>');
                $('#resetDatabaseDiv').slideDown();
                $('div#divLoader').window('close');
            }
        });

    }
</script>
<div style="text-align: center;">
    <a href="#" class="easyui-linkbutton" id="resetDatabaseBtn" data-options="iconCls:'icon-database--arrow'"  ><?php echo __('Reset DataBase'); ?></a>
</div>
<div class="info" id="resetDatabaseDiv"></div>